<template>
	<view class="set">

		<view class="set_item" v-for="item in setList" v-bind:key="item.path" @click="navigatorToDetail(item.path)">
			<text>{{item.title}}</text>
			<text>></text>
		</view>

		<view class="loginOut">
			<button type="default" v-on:click="loginOut">退出登录</button>
		</view>
		<!-- <navigator url="../public/login">跳转到登录</navigator> -->
	</view>
</template>

<script>
	import ajax from '@/api/api.js'
	import url from '@/api/url.js'
	// import Base64 from
	export default {
		data() {
			return {
				setList: [{
						title: "个人资料",
						path: '/pages/set/setPresonalData'
					},
					{
						title: "修改密码",
						path: '/pages/set/setChangePwd'
					},
					{
						title: "关于我们",
						path: '/pages/set/setAbout',
					},
				],

			}
		},
		methods: {
			//进入详情页
			navigatorToDetail(url) {
				this.$routerX.push(url)
			},
			// //登录
			// gologin() {
			// 	this.$londing();
			// 	var m = new Buffer('15226104865').toString('base64');
			// 	var p = new Buffer('123456').toString('base64');

			// 	ajax(url.login, {
			// 		data: {
			// 			mobile: m,
			// 			password: p
			// 		}
			// 	}).then(res => {
			// 		console.log(res.data.data.token)
			// 		try {
			// 			uni.setStorageSync('token', res.data.data.token)

			// 		} catch (e) {
			// 			console.log()
			// 		}
			// 	}).catch(err => {
			// 		console.log(err)
			// 	})

			// },
			// 退出登录
			loginOut() {
				this.$londing();

				ajax(url.loginOut, {

				}).then(res => {
					console.log(res)
					uni.clearStorageSync('token');
					uni.reLaunch({
						url: '/pages/index/index'
					});
				}).catch(err => {
					console.log(err)
				})
			},


		},
		onLoad() {
			// this.gologin()
		},
		//监听用户下拉动作
		onPullDownRefresh() {
			console.log('下拉刷新')
			setTimeout(() => {
				this.gologin()
			}, 1000)
			console.log('停止刷新')
			//停止刷新
			uni.stopPullDownRefresh()
		},

	}
</script>

<style lang="scss">
	.set {
		.set_item {
			padding: 20rpx 15px;
			background: white;
			line-height: 54px;
			display: flex;
			justify-content: space-between;
			border-bottom: 1px solid #eee;

			text:nth-child(2) {
				color: #666666;
			}
		}

		.loginOut {
			button {
				background: white;
				font-size: 15px;
				color: #3280F5;
				margin-top: 54px;
				line-height: 40px;
				text-align: center;
			}

		}
	}
</style>